/* import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


import Layout from '@/layout'

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '成绩管理系统', icon: 'dashboard' }
    }]
  },
  {
    path: '/systemmanage',
    component: Layout,
    redirect: '/systemmanage/user',
    name: 'systemmanage',
    meta: { title: '系统管理', icon: 'el-icon-s-help' },
    children: [
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/SystemManage/user'),
        meta: { title: '用户管理', icon: 'el-icon-s-custom' },
      },
      {
        path: 'class',
        name: 'class',
        component: () => import('@/views/SystemManage/class'),
        meta: { title: '班级管理', icon: 'el-icon-s-home' },
      },
      {
        path: 'course',
        name: 'course',
        component: () => import('@/views/SystemManage/course'),
        meta: { title: '课程管理', icon: 'el-icon-collection' }
      },
      {
        path: 'assignteacher',
        name: 'assignteacher',
        component: () => import('@/views/SystemManage/assignteacher'),
        meta: { title: '教师分配', icon: 'el-icon-circle-plus' }
      },
      {
        path: 'students',
        name: 'students',
        component: () => import('@/views/SystemManage/students'),
        meta: { title: '班级成员', icon: 'tree' }
      }
    ]
  },
  {
    path: '/scoreshow',
    component: Layout,
    name: 'scoreshow',
    meta: { title: '成绩管理', icon: 'el-icon-s-order' },
    children: [
      {
        path: 'score',
        name: 'scoreshow-score',
        component: () => import('@/views/scoreshow/score/index'),
        meta: { title: '成绩展示', icon: 'el-icon-collection' }
      },
      {
        path: 'shape',
        name: 'scoreshow-shape',
        component: () => import('@/views/scoreshow/shape/index'),
        meta: { title: '可视化', icon: 'el-icon-view' }
      }
    ]
  },
  {
    path: '/scoreinput',
    component: Layout,
    children: [{
      path: 'index',
      name: 'scoreinput',
      component: () => import('@/views/scoreinput/index'),
      meta: { title: '成绩录入', icon: 'el-icon-circle-plus' }
    }]
  },
  {
    path: '/student',
    component: Layout,
    name: 'student',
    meta: { title: '学生功能', icon: 'el-icon-reading' },
    children: [
      {
        path: 'courses',
        name: 'student-courses',
        component: () => import('@/views/student/courses/index'),
        meta: { title: '我的课程', icon: 'el-icon-notebook-1' }
      },
      {
        path: 'scores',
        name: 'student-scores',
        component: () => import('@/views/student/scores/index'),
        meta: { title: '我的成绩', icon: 'el-icon-collection' }
      }
    ]
  },
  {
    path: '/userinfo',
    component: Layout,
    children: [{
      path: 'index',
      name: 'userinfo',
      component: () => import('@/views/userInfo/index'),
      meta: { title: '个人信息', icon: 'el-icon-user-solid' }
    }]
  },

  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
 */

import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },

  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },

  {
    path: "/",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "dashboard",
        name: "Dashboard",
        component: () => import("@/views/dashboard/index"),
        meta: { title: "成绩管理系统", icon: "dashboard" },
      },
    ],
  },

  // {
  //   path: "/log",
  //   component: Layout,
  //   children: [
  //     {
  //       path: "logback",
  //       name: "Logback",
  //       component: () => import("@/views/logback/index"),
  //       meta: { title: "操作日志", icon: "el-icon-document" },
  //     },
  //   ],
  // },

  // {
  //   path: '/systemmanage',
  //   component: Layout,
  //   redirect: '/systemmanage/user',
  //   name: 'systemmanage',
  //   meta: { title: '系统管理', icon: 'el-icon-s-help' },
  //   children: [
  //     {
  //       path: 'user',
  //       name: 'user',
  //       component: () => import('@/views/SystemManage/user'),
  //       meta: { title: '用户管理', icon: 'el-icon-s-custom' },
  //     },
  //     {
  //       path: 'class',
  //       name: 'class',
  //       component: () => import('@/views/SystemManage/class'),
  //       meta: { title: '班级管理', icon: 'el-icon-s-home' },
  //     },
  //     {
  //       path: 'course',
  //       name: 'course',
  //       component: () => import('@/views/SystemManage/course'),
  //       meta: { title: '课程管理', icon: 'el-icon-collection' }
  //     },
  //     {
  //       path: 'assignteacher',
  //       name: 'assignteacher',
  //       component: () => import('@/views/SystemManage/assignteacher'),
  //       meta: { title: '教师分配', icon: 'el-icon-circle-plus' }
  //     },
  //     {
  //       path: 'students',
  //       name: 'students',
  //       component: () => import('@/views/SystemManage/students'),
  //       meta: { title: '班级成员', icon: 'tree' }
  //     }
  //   ]
  // },
  // {
  //   path: '/scoreshow',
  //   component: Layout,
  //   name: 'scoreshow',
  //   meta: { title: '成绩管理', icon: 'el-icon-s-order' },
  //   children: [
  //     {
  //       path: 'score',
  //       name: 'scoreshow-score',
  //       component: () => import('@/views/scoreshow/score/index'),
  //       meta: { title: '成绩展示', icon: 'el-icon-collection' }
  //     },
  //     {
  //       path: 'shape',
  //       name: 'scoreshow-shape',
  //       component: () => import('@/views/scoreshow/shape/index'),
  //       meta: { title: '可视化', icon: 'el-icon-view' }
  //     }
  //   ]
  // },
  // {
  //   path: '/scoreinput',
  //   component: Layout,
  //   children: [{
  //     path: 'index',
  //     name: 'scoreinput',
  //     component: () => import('@/views/scoreinput/index'),
  //     meta: { title: '成绩录入', icon: 'el-icon-circle-plus' }
  //   }]
  // },
  // {
  //   path: '/student',
  //   component: Layout,
  //   name: 'student',
  //   meta: { title: '学生功能', icon: 'el-icon-reading' },
  //   children: [
  //     {
  //       path: 'courses',
  //       name: 'student-courses',
  //       component: () => import('@/views/student/courses/index'),
  //       meta: { title: '我的课程', icon: 'el-icon-notebook-1' }
  //     },
  //     {
  //       path: 'scores',
  //       name: 'student-scores',
  //       component: () => import('@/views/student/scores/index'),
  //       meta: { title: '我的成绩', icon: 'el-icon-collection' }
  //     }
  //   ]
  // },
  // {
  //   path: '/userinfo',
  //   component: Layout,
  //   children: [{
  //     path: 'index',
  //     name: 'userinfo',
  //     component: () => import('@/views/userInfo/index'),
  //     meta: { title: '个人信息', icon: 'el-icon-user-solid' }
  //   }]
  // },

  // { path: '*', redirect: '/404', hidden: true }
];

const createRouter = () =>
  new Router({
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
  });

const router = createRouter();
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
